//
//  DeviceCell.swift
//  TBCode
//
//  Created by nexgo on 2017/10/31.
//  Copyright © 2017年 truth. All rights reserved.
//

import UIKit

class DeviceCell: UITableViewCell {

    class func getNewCell() -> DeviceCell{
        let objects = UINib(nibName: "DeviceCell", bundle: nil).instantiate(withOwner: nil, options: nil);
        let obj: AnyObject = objects[0] as AnyObject;
        
        let cell = obj as! DeviceCell;
        
        return cell;
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    @IBOutlet weak var txt_name: UILabel!
    @IBOutlet weak var txt_uuid: UILabel!
    @IBOutlet weak var txt_rssi: UILabel!
    
    // 设置数据
    public func setData(device:TBBLEDevice!){
        
        if(device.peripheral.name == nil){
            txt_name.text = "unknow";
        } else {
            txt_name.text = device.peripheral.name!;
        }
        
        txt_rssi.text = "Rssi:\(device.rssi)";
        
        txt_uuid.text = device.peripheral.identifier.uuidString;
    }
    
}
